package org.feiye.studyday14;

//封装企鹅类
public class Penguin {
	private String name;
	private int age;
	private int health;
	private String brain;

	public Penguin() {
	}

	public Penguin(String name, int age, int health, String brain) {
		this.name = name;
		this.age = age;
		this.health = health;
		this.brain = brain;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setAge(int age) {
		if (age < 0 || age > 36) {
			System.out.println("企鹅的年龄超出范围！");
			this.age = 1;
			return;
		}
		this.age = age;
	}

	public int getAge() {
		return age;
	}

	public void setHealth(int health) {
		if (health > 100 || health < 0) {
			System.out.println("企鹅的健康值在0-100之间！");
			this.health = 50;
			return;
		}
		this.health = health;
	}

	public int getHealth() {
		return health;
	}


	public void setBrain(String brain) {
		this.brain = brain;
	}

	public String getBrain() {
		return brain;
	}

	public void introduction() {
		System.out.println(
				"我是一只名叫" + this.name + "的" + this.brain + "，" + "我今年" + this.age + "岁了，我很健康强壮，我的体力值是：" + this.health);
	}

}
